package com.example.tool.activtiy;

import android.annotation.SuppressLint;
import android.support.v7.widget.RecyclerView;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.tool.R;
import com.example.tool.activtiy.base.BaseActivity;
import com.example.tool.mvp.CommonPresent;
import com.example.tool.util.DebugLog;
import com.example.tool.util.ToastUtil;
import com.example.tool.widget.event.MyButton;

import butterknife.BindView;

import static com.example.tool.util.DebugLog.EVENT_VIEW;

public class EventActivity extends BaseActivity<CommonPresent> {
    //    @BindView(R.id.rv_home)
//    RecyclerView recyclerView;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.btn01)
    MyButton btn01;
    @BindView(R.id.btn02)
    MyButton btn02;
//    private LinearLayoutManager layoutManager;
//    private CommonTextAdapter homeRvAdapter;
//    private String[] strings = null;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_event;
    }

    @Override
    protected void initView() {
//        strings = getResources().getStringArray(R.array.event_item_array);
//        recyclerView = findViewById(R.id.rv_home);
//        tvTitle = findViewById(R.id.tv_title);
//        layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
//        recyclerView.setLayoutManager(layoutManager);
//        homeRvAdapter = new CommonTextAdapter(R.layout.font_item, Arrays.asList(strings), this);
//        recyclerView.setAdapter(homeRvAdapter);
        tvTitle.setText("事件研究");
    }

    @Override
    protected void initData() {

    }

    @SuppressLint("ClickableViewAccessibility")
    @Override
    protected void initEvent() {
        btn01.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                int action = event.getAction();
                switch (action) {
                    case MotionEvent.ACTION_DOWN:
                        DebugLog.d(EVENT_VIEW + " btn01  onTouch ACTION_DOWN");
                        break;
                    case MotionEvent.ACTION_MOVE:
                        DebugLog.d(EVENT_VIEW + "btn01  onTouch ACTION_MOVE");
                        break;
                    case MotionEvent.ACTION_UP:
                        DebugLog.d(EVENT_VIEW + "btn01   onTouch ACTION_UP");
                        break;
                    default:
                        break;
                }

                return true; //消费掉了，
//                return false; //不消费掉
            }
        });
        btn02.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                int action = event.getAction();

                switch (action) {
                    case MotionEvent.ACTION_DOWN:
                        DebugLog.d(EVENT_VIEW + " btn02  onTouch ACTION_DOWN");
                        break;
                    case MotionEvent.ACTION_MOVE:
                        DebugLog.d(EVENT_VIEW + "btn02  onTouch ACTION_MOVE");
                        break;
                    case MotionEvent.ACTION_UP:
                        DebugLog.d(EVENT_VIEW + "btn02   onTouch ACTION_UP");
                        break;
                    default:
                        break;
                }

                return true; //消费掉了，
//                return false; //不消费掉
            }
        });
//        homeRvAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
//            @Override
//            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
//                switch (position) {
//                    case 0:
//                        ToastUtil.toastShortContent("position "+position);
//                        break;
//
//                    case 1:
//
//                        break;
//                }
//            }
//        });
    }

    @Override
    protected CommonPresent createPresenter() {
        return null;
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
//        DebugLog.d(EVENT_VIEW + " dispatchTouchEvent-- " + super.dispatchTouchEvent(ev));
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
//        DebugLog.d(EVENT_VIEW + " onTouchEvent-- " + super.onTouchEvent(event));
        return super.onTouchEvent(event);
    }
}
